package entity

import "time"

type User struct {
	ID			int			`json:"id"`
	Name		string		`json:"name" binding:"required"`
	Age			int			`json:"age" binding:"required"`
	CreatedAt	time.Time	`json:"created_at"`
	UpdatedAt 	time.Time	`json:"updated_at"`
	
	Cars		[]*Car		`json:"cars"`
	Groups		[]*Group		`json:"groups"`
}

type Users []*User

func (u Users) ToIDs() []int {
	ids := make([]int, 0)
	if u == nil {
		return ids
	}
	for _, user := range u {
		ids = append(ids, user.ID)
	}
	return ids
}